#include<stdio.h>

int atoi(const char *s)
{
    int result=0;
    int sign=1;

    if(*s=='-')
    {
        sign=-1;
    }
    while(*s != '\0')
    {
        if(*s>='0'&&*s<='9')
            result= result*10+*s-'0';
        s++;
    }
    return result*sign;
}

int main()
{
    const char *s= "-1204";
    int a= atoi(s);
    printf("%d\n",a);
    return 0;
}